Skip to content

Move the DOM-free simulator code into pxtsimcore - #11785

Draft
Eric Anderson (humanapp) wants to merge 1 commit into
humanapp/stack/3-boardviewfrom
humanapp/stack/4-simcore-move
Draft

Eric Anderson (humanapp) wants to merge 1 commit into
humanapp/stack/3-boardviewfrom
humanapp/stack/4-simcore-move

Conversation

@humanapp

@humanapp Eric Anderson (humanapp) commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Fourth of the stacked PRs replacing #11665 (4/7).

  • Split pxtsim into two projects sharing the pxsim namespace: pxtsimcore/ for the runtime, board state, sound and host layers, pxtsim/ for the embed, views, Web Audio and iframes.
  • By design, pxtsimcore compiles without the dom lib, so core code that attempts to access browser APIs fails the build.
  • Most of this diff is just file moves. The code changes are in embed.ts, simlib.ts, debugger.ts and runtime.ts, where the DOM-free parts were split out into new core files.
  • Kept built/pxtsim.js and built/pxtsim.d.ts as the outputs, so nothing changes for consumers.

Changes in gulpfile.js

  • The pxtsim task now compiles pxtsimcore, then pxtsim against its declarations, and concatenates the two into built/pxtsim.js and built/pxtsim.d.ts. Downstream tasks are unchanged.
  • Added pxtsimcore to lint, updatestrings, and watch lists.

@humanapp
Eric Anderson (humanapp) force-pushed the humanapp/stack/4-simcore-move branch 3 times, most recently from 663ba2e to c3de8f3 Compare November 24, 2026 19:05
- Split pxtsim into two projects sharing the pxsim namespace: pxtsimcore/ for the runtime, board state, sound and host layers, pxtsim/ for the embed, views, Web Audio and iframes.
- pxtsimcore compiles without the dom lib, so core code that references the DOM fails the build.
- Most of the diff is renames. The content changes are in embed.ts, simlib.ts, debugger.ts and runtime.ts, where the DOM-free parts were split out into new core files.
- Kept built/pxtsim.js and built/pxtsim.d.ts as the outputs, so nothing changes for consumers.
- Added pxtsimcore/README.md: the layout, the boundary rules, the host layers and the virtual host.
- Made the gulp pxtsim task compile pxtsimcore, then pxtsim against its declarations, and concatenate the two. Added pxtsimcore to the lint, updatestrings and watch lists.

Build and the simulator test tasks pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant